﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Página sin título</title>
    <script language="javascript" type="text/javascript">
        // GET handling code taken from Rik Arends, comment #45 (http://www.11tmr.com/11tmr.nsf/D6Plinks/MWHE-695L9Z)
        var _GET = {};
        
        for (var m, v = location.href.split(/[?&]/), k = v.length - 1; k > 0; k--)
            _GET[(m = v[k].split(/[=#]/))[0]] = m.length > 1 ? decodeURI(m[1]) : "";
        
        var items = new Array();
        var version = "0.1 alpha";
        
        function addItem(id, title, date, categories, content) {
            items.push({id: id,
                title: title,
                date: date,
                categories: categories,
                content: content});
        }
        
        function applySettings() {
            document.title = settings["title"];
            document.getElementById("author").innerHTML = settings["author"];
            document.getElementById("description").innerHTML = settings["description"];
            document.getElementById("e_mail").innerHTML = settings["e_mail"];
            document.getElementById("title").innerHTML = settings["title"];
            document.getElementById("version").innerHTML = version;
        }
        
        function render() {
            if (!("i" in _GET))
                showItems(10);
            else
                showItem(parseInt(_GET.i));
        }
        
        function showItem(id) {
            var buffer;
            
            // FIXME: Check whether passed id's contained within items
            if (!isNaN(id))
                buffer =
                    "<div class=\"item\">" +
                        "<div class=\"title\">" +
                            "<a href=\"javascript: showItem(" + id + ");\">" +
                            items[--id].title + "</a>" +
                            "</div>" +
                        "<div class=\"information\">Digitalized on " + items[id].date +
                            // FIXME: Treat each category
                            " under " + items[id].categories +
                            " by " + settings["author"] +
                            " (<a href=\"Index.htm?i=" + (id + 1) + "\">#</a>)" +
                        "</div>" +
                        "<div class=\"content\">" + items[id].content + "</div>" +
                    "</div>";
            else
                buffer = "Sorry, your request returned no items.";
            
            document.getElementById("items").innerHTML = buffer;
        }
        
        function showItems(length) {
            var buffer = "";
            
            // FIXME: Hackish, I can do it better
            for (var i = items.length - 1; (i >= 0) && ((items.length - i - 1) < length); i--)
                buffer +=
                    "<div class=\"item\">" +
                        "<div class=\"title\">" +
                            "<a href=\"javascript: showItem(" + (items[i].id + 1) + ");\">" +
                            items[i].title + "</a>" +
                            "</div>" +
                        "<div class=\"information\">Digitalized on " + items[i].date +
                            // FIXME: Treat each category
                            " under " + items[i].categories +
                            " by " + settings["author"] +
                            " (<a href=\"Index.htm?i=" + (items[i].id + 1) + "\">#</a>)" +
                        "</div>" +
                        "<div class=\"content\">" + items[i].content + "</div>" +
                    "</div>";
            
            document.getElementById("items").innerHTML = buffer;
        }
    </script>
    <script language="javascript" src="Items.js" type="text/javascript"></script>
    <script language="javascript" src="Settings.js" type="text/javascript"></script>
    <style type="text/css">
        body
        {
        }

        .blog
        {
            font-family: Tahoma;
            font-size: 16px;
            margin: 0px auto;
            width: 800px;
        }

        .content
        {
            margin-bottom: 10px;
        }

        .footer
        {
            font-size: 0.75em;
            text-align: center;
        }

        .header
        {
            font-size: 3em;
            margin-bottom: 25px;
        }

        .header a
        {
            color: Black;
            text-decoration: none;
        }

        .header-description
        {
            font-size: 0.5em;
        }

        .information
        {
            font-size: 0.75em;
            margin-bottom: 10px;
        }

        .item
        {
            margin-bottom: 50px;
        }

        .menu
        {
            margin-bottom: 25px;
        }

        .title
        {
            font-size: 2em;
        }

        .title a
        {
            color: Black;
            text-decoration: none;
        }
    </style>
</head>
<body onload="applySettings(); render();">
    <div class="blog">
        <div class="header">
            <!-- FIXME: Length should be hardcoded elsewhere -->
            <a href="javascript: showItems(10);" id="title"></a>
            <div class="header-description" id="description"></div>
        </div>
        <div class="menu">
            <!--Choose a date: -->
            <!--<asp:DropDownList DataTextField="Date" DataValueField="Value" ID="ddlArchive" runat="server">
            </asp:DropDownList> 
            <asp:Button ID="btnDate" OnClick="btnDate_OnClick" runat="server" Text="Go!" />--><!-- | -->
            Contact: <span id="e_mail"></span> | 
            Export items as: <a href="http://www.planetaki.com/marcoscm">RSS</a>
        </div>
        <div id="items"></div>
        <div class="footer">
            &copy; 2006-08 <span id="author"></span><br />
            Generated by LIM ver. <span id="version"></span>
        </div>
    </div>
</body>
</html>
